class Company {
    constructor({
      id,
      name,
      capital,
      year,
      people,
      address,
      industry,
      introduction,
      like,
      created_date: createdDate,
      updated_date: updatedDate,
    }) {
      this.company = {
        id: String,
        name: String,
        capital: String,
        year: String,
        people: String,
        address: String,
        industry: String,
        introduction: String,
        like: String,
        created_date: Number,
        updated_date: Number,
      }
      this.company.id = id
      this.company.name = name
      this.company.capital = capital
      this.company.year = year
      this.company.people = people
      this.company.address = address
      this.company.industry = industry
      this.company.introduction = introduction
      this.company.like = like
      this.company.created_date = createdDate
      this.company.updated_date = updatedDate
    }
  
    getData() {
      const { company } = this
      const companyWithNoNull = { ...this.company }
  
      const properties = Object.getOwnPropertyNames(this.company)
  
      properties.forEach((property) => {
        if (Reflect.get(this.company, property) == null) {
          Reflect.deleteProperty(companyWithNoNull, property)
        }
      })
  
      return { company, companyWithNoNull }
    }
  
    get id() {
      return this.company.id === undefined ? null : this.company.id
    }
  
    set id(value) {
      this.company.id = value
    }

    get name() {
      return this.company.name === undefined ? null : this.company.name
    }
  
    set name(value) {
      this.company.name = value
    }
  
    get capital() {
        return this.company.capital === undefined ? null : this.company.capital
      }
    
    set capital(value) {
        this.company.capital = value
    }

    get year() {
        return this.company.year === undefined ? null : this.company.year
      }
    
    set year(value) {
        this.company.year = value
    }

    get people() {
        return this.company.people === undefined ? null : this.company.people
      }
    
    set people(value) {
        this.company.people = value
    }

    get address() {
        return this.company.address === undefined ? null : this.company.address
      }
    
    set address(value) {
        this.company.address = value
    }

    get industry() {
        return this.company.industry === undefined ? null : this.company.industry
      }
    
    set industry(value) {
        this.company.industry = value
    }

    get introduction() {
        return this.company.introduction === undefined ? null : this.company.introduction
      }
    
    set introduction(value) {
        this.company.introduction = value
    }

    get like() {
        return this.company.like === undefined ? null : this.company.like
      }
    
    set like(value) {
        this.company.like = value
    }

    get createdDate() {
      return this.company.created_date === undefined
        ? null
        : this.company.created_date
    }
  
    set createdDate(value) {
      this.company.created_date = value
    }
  
    get updatedDate() {
      return this.company.updated_date === undefined
        ? null
        : this.company.updated_date
    }
  
    set updatedDate(value) {
      this.company.updated_date = value
    }
  }
  
  module.exports = Company
  